import { Environment, OrbitControls } from "@react-three/drei";
import * as THREE from "three";
import { useEffect } from "react";
import gsap from "gsap";
import { useThree } from "@react-three/fiber";

export const Scence = () => {
  const { camera } = useThree();
  const animate = () => {
    // 动画
    const position = new THREE.Vector3(0, 0, 0);
    gsap.fromTo(
      position,
      {
        x: 0,
        y: 0,
        z: 0,
      },
      {
        x: 0,
        y: 0,
        z: 60,
        duration: 10,
        onUpdate: () => {
          camera.position.copy(position);
          camera.position.set(position.x, position.y, position.z);
        },
      }
    );
  };
  useEffect(() => {
    // animate();
  }, []);
  return (
    <>
      <OrbitControls></OrbitControls>
      <ambientLight
        position={new THREE.Vector3(0, 40, 0)}
        color={new THREE.Color("#ffffff")}
        intensity={1}
      ></ambientLight>
      {/* <axesHelper scale={80}></axesHelper> */}
    </>
  );
};
